package cn.mw.cmdb.service;

import cn.mw.cmdb.entity.instanceToPo.*;
import cn.mw.cmdb.entity.modelRelation.ModelAlertWeightInfo;
import cn.mw.cmdb.param.TrendQueryParam;
import cn.mw.microMonitorCommon.api.cmdb.AlertWeightConfigInfo;

import java.util.List;

public interface InstanceToPoService {
    InstanceViewInfo createInstanceView(InstanceViewInfo param);

    boolean editInstanceView(InstanceViewInfo param);

    boolean deleteInstanceView(InstanceViewInfo param) throws Exception;

    List<InstanceViewInfo> getInstanceView(InstanceViewInfo param) throws Exception;

    InstanceTopoView dealInstanceToPo(QueryInstanceRelationToPoParam param) throws Exception;

    List<ModelAssociatedView> getModelRelationInfo(QueryInstanceRelationToPoParam param) throws Exception;

    boolean addInstanceToPo(QueryInstanceRelationToPoParam param);

    List<IntanceTopoSelView> getInstanceTopoSelTree(QueryInstanceRelationToPoParam param);

    ModelAlertWeightInfo addOrUpdateModelAlertWeightInfo(ModelAlertWeightInfo modelAlertWeightInfo) throws Exception;

    ModelAlertWeightInfo getModelAlertWeightInfo(ModelAlertWeightInfo modelAlertWeightInfo) throws Exception;

    boolean deleteModelAlertWeightInfo(ModelAlertWeightInfo modelAlertWeightInfo) throws Exception;

    /**
     * 通过实例id查询受影响的业务模型
     *
     * @param instanceId
     * @return
     */
    List<AlertWeightConfigInfo> getAlertWeightConfigInfosByInstanceId(String instanceId) throws Exception;

    /**
     * 通过实例id查询关联资产实例id
     *
     * @param instanceId
     * @return
     */
    List<String> getRelationInstanceIds(String modelId, String instanceId) throws Exception;

    /**
     * 通过业务健康度趋势数据
     *
     * @param instanceId
     * @return
     */
    InstanceHealthTrendVo getBusinessHealthTrend(String instanceId, TrendQueryParam queryParam) throws Exception;

    boolean updateInstanceHealth(String instanceId, Double healthCount);
}
